XPort ETH SE Click
XPort ETH SE Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.
Click Library
- Author : Stefan Filipovic
- Date : Jan 2025.
- Type : UART type
Software Support
Example Description
This example demonstrates the use of the XPort ETH SE Click board for Ethernet communication. The application initializes the XPort ETH SE module, retrieves essential information such as firmware version, MAC address, and network status, and demonstrates sending a ping command. It also allows for bidirectional UART communication between the USB UART and the XPort ETH SE UART.
Example Libraries
- MikroSDK.Board
- MikroSDK.Log
- Click.XPortETHSE
Example Key Functions
- xportethse_cfg_setup This function initializes Click configuration structure to initial values.
void xportethse_cfg_setup(xportethse_cfg_t *cfg)
XPort ETH SE configuration object setup function.
XPort ETH SE Click configuration object.
Definition xportethse.h:200
- xportethse_init This function initializes all necessary pins and peripherals used for this Click board.
err_t xportethse_init(xportethse_t *ctx, xportethse_cfg_t *cfg)
XPort ETH SE initialization function.
XPort ETH SE Click context object.
Definition xportethse.h:177
- xportethse_reset_device This function resets device by toggling the RST pin state.
void xportethse_reset_device(xportethse_t *ctx)
XPort ETH SE reset device function.
- xportethse_send_cmd This function sends a command string by using UART serial interface.
void xportethse_send_cmd(xportethse_t *ctx, uint8_t *cmd)
XPort ETH SE send cmd function.
- xportethse_send_enter This function sends enter (new line) by using UART serial interface.
void xportethse_send_enter(xportethse_t *ctx)
XPort ETH SE send enter function.
Application Init
Initializes the UART communication, logs essential information, configures the XPort ETH SE module, and retrieves the firmware version, MAC address, and network status. It also demonstrates basic command operations such as pinging the specific IP address (8.8.8.8).
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_printf( &logger, ">>> Reset Device to Monitor Mode <<<\r\n" );
xportethse_read_response ( &xportethse );
log_printf( &logger, "\r\n-----------------------------\r\n" );
log_printf( &logger, ">>> Query Firmware Version <<<\r\n" );
xportethse_read_response ( &xportethse );
log_printf( &logger, "\r\n-----------------------------\r\n" );
log_printf( &logger, ">>> Get MAC Address <<<\r\n" );
xportethse_read_response ( &xportethse );
log_printf( &logger, "\r\n-----------------------------\r\n" );
log_printf( &logger, ">>> Get Network Status and IP Address <<<\r\n" );
log_printf( &logger, ">>> Send QU Command to Exit Monitor Mode and Connect to Listed <<<\r\n" );
log_printf( &logger, ">>> IP Address Through Web Browser to Access Web Interface <<<\r\n" );
xportethse_read_response ( &xportethse );
log_printf( &logger, "\r\n-----------------------------\r\n" );
log_printf( &logger, ">>> Ping 8.8.8.8 and Switch to UART Terminal Commands Input <<<\r\n" );
xportethse_read_response ( &xportethse );
}
#define XPORTETHSE_CMD_QUERY_FW_VERSION
Definition xportethse.h:123
#define XPORTETHSE_CMD_GET_MAC_ADDRESS
Definition xportethse.h:96
#define XPORTETHSE_CMD_MODE_MONITOR_WITH_NET
Definition xportethse.h:75
#define XPORTETHSE_CMD_PING(ADR)
Definition xportethse.h:99
#define XPORTETHSE_CMD_NET_STAT
Definition xportethse.h:98
#define XPORTETHSE_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition xportethse.h:161
void application_init(void)
Definition main.c:85
#define MIKROBUS_POSITION_XPORTETHSE
Definition main.c:41
Application Task
Continuously reads data from the USB UART and forwards it to the XPort ETH SE module, while also capturing responses from the module and forwarding them back to the USB UART. This allows real-time interaction with the device through the UART Terminal for configuration and diagnostics.
{
if ( app_buf_len > 0 )
{
uart_write ( &xportethse.uart, app_buf, app_buf_len );
xportethse_clear_app_buf ( );
}
if ( app_buf_len > 0 )
{
uart_write ( &logger.uart, app_buf, app_buf_len );
xportethse_clear_app_buf ( );
}
}
void application_task(void)
Definition main.c:142
#define PROCESS_BUFFER_SIZE
Definition main.c:46
Note
Ensure the XPort ETH SE Click board is properly connected to the network.
Application Output
This Click board can be interfaced and monitored in two ways:
- Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
- UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.
Additional Notes and Information
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.